package com.vgmobile.cucrever2.search;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.vgmobile.cucrever2.R;
import com.vgmobile.cucrever2.global.BaseActivity;

public class SearchActivity extends BaseActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.search_activity);

	}
	
	public void clickSearch(View view){
		Intent intent = new Intent("com.google.zxing.client.android.SCAN");
		intent.putExtra("SCAN_MODE", "QR_CODE_MODE,PRODUCT_MODE");
		startActivityForResult(intent, CODE_SCAN);
	}

	public void onActivityResult(int requestCode, int resultCode, Intent intent) {
		if (requestCode == CODE_SCAN) {
			if (resultCode == RESULT_OK) {
				String contents = intent.getStringExtra("SCAN_RESULT");
				String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
				Toast.makeText(this, format + "   -   " + contents, Toast.LENGTH_SHORT).show();
			} else if (resultCode == RESULT_CANCELED) {
				// Handle cancel
			}
		}
	}
	
	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
        overridePendingTransition(R.anim.activity_back_fade_in, R.anim.activity_back_fade_out);
		super.onDestroy();
	}
}
